﻿@using System.Globalization;
<style type="text/css">
    img.fans-portrait {
        width: 50px;
        height: 50px;
    }
    .fsh-rightPanel .layui-table-body .layui-table-cell {
        height: 50px;
        line-height: 50px;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card fsh-rightPanel">
        <div class="layui-card-body">
            <div class="layui-form  layui-form-pane layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <button class="layui-btn  layui-btn-normal layuiadmin-btn-tags" style="float:right;" lay-submit lay-filter="LAY-app-exportexcel">导出筛选数据</button>
                </div>
            </div>
            <table id="LAY-customer-list" lay-filter="LAY-customer-list"></table>
        </div>
    </div>
</div>
<script type="text/html" id="activeTpl">
    <input type="checkbox" name="Active" lay-skin="switch" value="{{d.Id}}" lay-filter="active" lay-text="激活|停用" {{ d.Active ? 'checked' : ''}}>
</script>
<script>
    layui.use(['index', 'table'], function () {
            var index = layer.load(2, { shade: false });
            var table = layui.table
                , form = layui.form;
        //分类管理
        table.render({
            elem: '#LAY-customer-list'
            , url: '@Html.Raw(Url.Action("Users",new { Id=ViewBag.Id}))' //模拟接口
            ,method:'post'
            , page: true //开启分页
            , even: true
            , limit: 15
            , limits: [15,30,50,100]
            , cols: [[
                { type: 'numbers' }
                , { field: 'Id', width: 100, title: 'ID' }
                , { field: 'ImgUrl', width: 110, title: '头像', templet: function (d) { return "<img class='fans-portrait' src=" + d.ImgUrl + " />" } }
                , { field: 'Nickname', title: '昵称', minWidth: 100 }
                , { field: 'ShopName', title: '姓名', minWidth: 100 }
                , { field: 'Phone', title: '电话', width: 120, align: 'center' }
                , { field: 'CreateTime', title: '创建时间', width: 180, align: 'center', templet: '<div>{{ layui.util.timeAgo(d.CreateTime) }}</div>' }
            ]]
            , text: { none: '一条数据也没有^_^' }
            , done: function () {
                layer.close(index);
            }
         });

        //监听搜索
         layui.form.on('submit(LAY-app-exportexcel)', function (data) {
             var field = data.field;
             window.location.href = '@Url.Action("ExportUserExcelAll")?CustomerId=' + @ViewBag.Id 
         });

        var $ = layui.$, active = { }
        $('.layui-btn.layuiadmin-btn-tags').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>







